import com.google.appengine.api.datastore.Entity
import com.google.appengine.api.datastore.Blob
import com.google.appengine.api.datastore.Key
import com.google.appengine.api.datastore.*
import static com.google.appengine.api.datastore.FetchOptions.Builder.*
import com.pobos.model.*


def idItem = params.id

if (idItem) {	
	Entity item = obtenItem(idItem)
	request['item'] = item
	request['idItem'] = idItem
	forward "/admin/modificaItem.gtpl"
} else {
	request.erro = "Non se atopou ese item!"
	forward '/erro.gtpl'
}
	

def obtenItem(String id) {
	def key = KeyFactory.createKey("Item", Long.parseLong(id))			
	return datastore.get(key)
}  



